﻿using Microsoft.EntityFrameworkCore;
using mozhi.smarterp.Finance.Accounts;
using mozhi.smarterp.Finance.Banks;
using mozhi.smarterp.Finance.Basedatas;
using mozhi.smarterp.Finance.DataDicts;
using mozhi.smarterp.Finance.Documents;
using mozhi.smarterp.Finance.Files;
using mozhi.smarterp.Finance.Finances;
using mozhi.smarterp.Finance.Logs;
using mozhi.smarterp.Finance.Reports;
using mozhi.smarterp.Finance.Treasuries;
using mozhi.smarterp.Finance.Treasuries.Payments;
using mozhi.smarterp.Finance.Views;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;

namespace mozhi.smarterp.Finance.EntityFrameworkCore;

[ConnectionStringName(FinanceDbProperties.ConnectionStringName)]
public class FinanceDbContext : AbpDbContext<FinanceDbContext>, IFinanceDbContext
{
    /* Add DbSet for each Aggregate Root here. Example:
     * public DbSet<Question> Questions { get; set; }
     */

    public DbSet<Account> Accounts { get; set; }

    public DbSet<vDefaultAccount> DefaultAccounts { get; set; }

    public DbSet<AccountDimension> AccountDimensions { get; set; }

    public DbSet<AccountDimensionItem> AccountDimensionItems { get; set; }

    public DbSet<BankType> BankTypes { set; get; }

    public DbSet<BankAccount> BankAccounts { set; get; }

    public DbSet<DataAssociation> DataAssociation { set; get; }

    public DbSet<Tag> Tags { set; get; }

    public DbSet<TagItem> TagItems { set; get; }

    public DbSet<AccountBalance> AccountBalances { set; get; }

    public DbSet<DimensionGroupValue> DimensionGroupValues { set; get; }

    public DbSet<Settlement> Settlements { set; get; }

    public DbSet<Journal> Journals { set; get; }

    public DbSet<JournalItem> JournalItems { set; get; }

    public DbSet<JournalNumberPrefix> JournalNumberPrefixes { set; get; }

    public DbSet<JournalTemplate> JournalTemplates { set; get; }

    public DbSet<EndPeriodProcessItem> EndPeriodProcesseItems { set; get; }

    public DbSet<EndPeriodProcessItemSetting> EndPeriodProcessItemSettings { set; get; }

    public DbSet<EndPeriodProcessResult> EndPeriodProcessResults { set; get; }

    public DbSet<EndPeriodProcessResultItem> EndPeriodProcessResultItems { set; get; }

    public DbSet<DocumentJournalRelationship> DocumentJournalRelationships { set; get; }

    public DbSet<FinancialReportItem> FinancialReportItems { set; get; }

    public DbSet<FinancialReportItemSetting> FinancialReportItemSettings { set; get; }

    public DbSet<OperationLog> OperationLogs { set; get; }

    public DbSet<OperationLogItem> OperationLogItems { set; get; }

    public DbSet<OperationLogSetting> OperationLogSettings { set; get; }


    public DbSet<OperationSettingItem> OperationSettingItems { set; get; }

    public DbSet<Attachment> Attachments { set; get; }

    public DbSet<File> Files { set; get; }

    public DbSet<PrintTemplate> PrintTemplates { set; get; }

    public DbSet<DataDictionary> DataDictionaries { set; get; }

    public DbSet<PaymentOrderLink> AdvancePaymentOrderLinks { set; get; }

    public DbSet<PaymentRequisition> PaymentRequisitions { set; get; }

    public DbSet<PaymentRequisitionLink> PaymentRequisitionLinks { set; get; }

    public DbSet<Payment> Payments { set; get; }


    public FinanceDbContext(DbContextOptions<FinanceDbContext> options)
        : base(options)
    {

    }

    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);

        builder.ConfigureFinance();
    }
}
